import request from '@/utils/request'

export default {
  factoryAllTag(factory,tag_name){
    return request({
      url:'/historian-tag/all',
      method:'get',
      params:{factory,tag_name}
    })
  },
  dcsStandardList(params){
    return request({
      url:'/dcs-standard/lists',
      method:'get',
      params
    })
  },
  dcsGroupList(tableQuery, tablePage){
    const params = {
      page:!tablePage.current?1:tablePage.current,
      num:!tablePage.size?20:tablePage.size,
      name:tableQuery.name,
    }
    return request({
      url:'/dcs-group',
      method:'get',
      params
    })
  },
  addDcsGroup(data){
    return request({
      url:'/dcs-group',
      method:'post',
      data
    })
  },
  updateDcsGroup(data){
    return request({
      url:`/dcs-group/${data.id}`,
      method:'put',
      data
    })
  },
  deleteDcsGroup(gid){
    return request({
      url:`/dcs-group/${gid}`,
      method:'delete'
    })
  },
  imptDcsGroups(json){
    return request({
      url:'/dcs-group/import',
      method:'post',
      data:{json}
    })
  },
  bindDcsGroup(data){
    return request({
      url:'/dcs-group/bind-relation',
      method:'post',
      data
    })
  },
  async getDcsRelation(gid){
    return request({
      url:`/dcs-group/show-relation/${gid}`,
      method:'get'
    })
  }
}
